package com.cqhfan.chatroom.controller;

import com.cqhfan.chatroom.domain.dto.FriendAddDTO;
import com.cqhfan.chatroom.domain.vo.MyFriendVO;
import com.cqhfan.chatroom.domain.vo.NewFriendVO;
import com.cqhfan.chatroom.service.IFriendService;
import com.cqhfan.common.domain.dto.PageDTO;
import com.cqhfan.common.domain.query.PageQuery;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 好友 前端控制器
 * </p>
 *
 * @author 眭传洪
 * @since 2024-11-18
 */
@Tag(name = "好友相关接口")
@RestController
@RequestMapping("/friend")
@RequiredArgsConstructor
public class FriendController {

    private final IFriendService friendService;

    @Operation(summary = "新朋友信息查询")
    @GetMapping("/listNewFriend")
    public PageDTO<NewFriendVO> listNewFriend(PageQuery query) {
        return friendService.listNewFriend(query);
    }

    @Operation(summary = "同意并添加好友信息")
    @PostMapping("/addFriendInfo")
    public void addFriendInfo(@RequestBody FriendAddDTO body) {
        friendService.addFriendInfo(body);
    }

    @Operation(summary = "我的好友列表")
    @GetMapping("/listMyFriends")
    public List<MyFriendVO> listMyFriends() {
        return friendService.listMyFriends();
    }

}
